﻿/*using System.Configuration;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.FileProviders;
using StudentManagementSystem;
using StudentManagementSystem.Models;

var builder = WebApplication.CreateBuilder(args);

// 注册 OracleDbContext
builder.Services.AddDbContext<OracleDBContext>(options =>
    options.UseOracle(builder.Configuration.GetConnectionString("OracleDBContext")));

// 注册 API 控制器
builder.Services.AddControllers();

// 添加 Swagger
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

// 添加静态文件服务
builder.Services.AddDirectoryBrowser();

// 添加日志（log4net）
builder.Logging.AddLog4Net("ConfigFile/log4net.Config");

var app = builder.Build();

// 配置静态文件路径
string path = Path.Combine(builder.Environment.ContentRootPath, "MyStaticFiles");
app.UseStaticFiles(new StaticFileOptions()
{
    FileProvider = new PhysicalFileProvider(path),
    RequestPath = "/StaticFiles"
});

// 启用目录浏览
app.UseDirectoryBrowser(new DirectoryBrowserOptions()
{
    FileProvider = new PhysicalFileProvider(path),
    RequestPath = "/StaticFiles"
});

// 启用 HSTS
app.UseHsts();

// 启用 Swagger
app.UseSwagger().UseSwaggerUI();

// 启用路由
app.UseRouting();

// 注册 API 路由
app.UseEndpoints(endpoints =>
{
    endpoints.MapControllers();
});

// 启用 HTTPS 重定向
app.UseHttpsRedirection();

// 添加配置读取端点
app.MapGet("/config", (IConfiguration config) =>
{
    var person = config.GetSection("person").Get<Person>();
    return Results.Ok(person);
});

// 添加自定义日志
app.Logger.LogInformation("程序启动成功!");

app.Run();*/